package com.fhz.day004.recycleview;

import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.recyclerview.widget.LinearLayoutManager;

import android.os.Bundle;

import com.fhz.day004.R;
import com.fhz.day004.databinding.ActivityMain2Binding;

import java.util.ArrayList;
import java.util.List;

public class Main2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_main2);

        ActivityMain2Binding binding = DataBindingUtil.setContentView(this, R.layout.activity_main2);


        //
        List<Food> list = new ArrayList<>();
        list.add(new Food("http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg","大虾"));
        list.add(new Food("http://www.qubaobei.com/ios/cf/uploadfile/132/9/8289.jpg","大虾"));

        MyAdapter myAdapter = new MyAdapter(list);
        binding.rv.setLayoutManager(new LinearLayoutManager(this));

        binding.rv.setAdapter(myAdapter);




    }
}